<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%--
  Created by IntelliJ IDEA.
  User: 17728
  Date: 2020/10/12
  Time: 14:42
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <link type="text/css" rel="stylesheet" href="static/css/style.css">
    <%@ include file="/pages/common/head.jsp" %>
    <script>
        function fun() {
            $.ajax({
                url: "http://localhost:8080/Work_war_exploded/NoticeServlet",
                data: {action: "queryNotice2"},
                type: "GET",
                success: function (data) {
                    var jsonObj = JSON.parse(data);
                    var str = "";
                    $.each(jsonObj, function (index, notice) {
                        str += "<tr align=\"center\">" +
                            "<td colspan=\"4\">" + notice.title + "</td>" +
                            "<td><a href='NoticeServlet?action=queryNoticeById&id=" + notice.id + "'> 查看</td> </tr>";

                    })
                    $("#tbody").html(str);
                    // $("#title1").html("标题："+jsonObj[0].title)
                },
                dataType: "text"
            });
        }

        $(function () {
        });
    </script>
    <style type="text/css">
        html, body {
            margin: 0;
            padding: 0;
            background-color: aliceblue;
        }

        .navbar {
            margin: 0 auto;
            width: 100%;
        }

        .header {
            background-image: linear-gradient(to right, #100736, #602D4F);
            width: 100%;
            height: 150px;
            color: #FFFFFF;
            font-size: 50px;
            position: relative;
            top: 0.625rem;

        }

        .hleft {
            float: left;
        }

        .hright {
            float: right;
        }

        .part1 {
            width: 100%;
            height: 60px;
            /* border: 1px solid red; */
            position: relative;
            top: 10px;
        }

        .part2 {
            width: 100%;
            height: 550px;
            /* border: 1px solid red; */
            position: relative;
            top: 20px;
        }

        .left2 {
            width: 64vw;
            height: 550px;
            /* border: 1px solid red; */

            float: left;
            position: relative;
            left: 10px;


        }

        .gonggao {
            position: relative;
            top: 10px;
            left: 10px;
            width: 63vw;
            height: 450px;

        }

        .d {
            text-align: center;
            position: relative;
            bottom: 0px;

        }

        .right2 {
            width: 34vw;
            height: 550px;
            /* border: 1px solid red; */
            float: right;
            position: relative;
            right: 10px;
            background-color: #8F613A;
        }

        .liuyan {
            width: 33vw;
            height: 530px;
            background-color: #F5E3B2;
            position: relative;
            top: 10px;

        }

        .b {
            height: 450px;
        }

        .c {
            text-align: center;
            position: relative;
            bottom: 0px;

        }

        table {
            background-color: white;
        }

        #bottom {
            width: 100%;
            height: 180px;
            position: relative;
            top: 100px;
            background-color: #2A2730;
            color: #FFFFFF;
        }

        #bottom p {
            text-align: center;
        }

        table {
            background-color: transparent;
        }
    </style>
</head>
<body onload="fun()">
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
                    data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="#">&nbsp;&nbsp;&nbsp;作业棒&nbsp;&nbsp;&nbsp;</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li class="active"><a href="MessageServlet?action=queryMessage1">教师界面<span
                        class="sr-only">(current)</span></a></li>
                <li><a href="pages/teacher/teach_assign.jsp">布置作业</a></li>
                <li><a href="HwServlet?action=queryHw&id=${sessionScope.teacher.id}">作业管理</a></li>
                <li><a href="pages/teacher/teacher_update.jsp">个人信息</a></li>
                <li><a href="pages/teacher/teacher_change.jsp">改密码</a></li>

            </ul>

            <ul class="nav navbar-nav navbar-right">
                <li><a href="UserServlet?action=logout">&nbsp;&nbsp;&nbsp;退出&nbsp;&nbsp;&nbsp;</a></li>

            </ul>
        </div><!-- /.navbar-collapse -->
    </div><!-- /.container-fluid -->
</nav>
<div class="header">
    <div class="hleft">
        <c:choose>
            <c:when test="${sessionScope.teacher == null && sessionScope.student != null}"><!-- 如果 -->
            </c:when>
            <c:otherwise> <!-- 否则 -->
                <c:choose>
                    <c:when test="${sessionScope.teacher == null}"><!-- 如果 -->
                        完善个人信息，否则无法进行操作！
                    </c:when>
                    <c:otherwise>你好，${sessionScope.teacher.name}老师</c:otherwise>
                </c:choose>
            </c:otherwise>
        </c:choose>
    </div>
    <br>
    <div class="hright">
        <div id="datetime">
            <script>
                setInterval("document.getElementById('datetime').innerHTML=new Date().toLocaleString();", 1000);
            </script>
        </div>
    </div>
</div>

<div class="part2">
    <div class="left2">
        <div class="gonggao">
            <table class="table table-hover">
                <thead align="center">
                <tr>
                    <td colspan="5"><h3>公告板</h3></td>
                </tr>
                </thead>
                <tbody id="tbody">

                </tbody>
                <%--      <tr align="center">--%>

                <%--        <td colspan="4">标题</td>--%>
                <%--        <td>查看</td>--%>
                <%--      </tr>--%>
                <%--      <tr align="center">--%>
                <%--        <td colspan="4" id="title1"></td>--%>
                <%--        <td>查看</td>--%>
                <%--      </tr>--%>


            </table>
        </div>

    </div>
    <div class="right2" align="center">

        <div class="liuyan">
            <div class="b">
                <table class="table table-hover">
                    <thead align="center">
                    <tr>
                        <td colspan="3"><h3>留言板</h3></td>
                    </tr>
                    <tr align="center">
                        <td>学生</td>
                        <td>状态</td>
                        <td>查看</td>
                    </tr>
                    <c:forEach items="${requestScope.mss}" var="mss">
                        <tr align="center">
                            <td>${mss.sname}</td>
                            <td>${mss.state}</td>
                            <td><a href="MessageServlet?action=queryMessageById&id=${mss.id}">查看</a></td>
                        </tr>
                    </c:forEach>
                    </thead>


                </table>
            </div>

        </div>
    </div>
</div>
<%@include file="/pages/common/footer.jsp" %>
</body>
</html>
